package com.example.myxm;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myxm.auth.LoginManager;
import com.example.myxm.activity.LoginActivity;
import com.example.myxm.activity.MainActivity;

public class WelcomeActivity extends AppCompatActivity {
    Button bt_know_wel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        //绑定控件
        bt_know_wel = findViewById(R.id.bt_know_wel);
        //按钮单击事件
//        bt_know_wel.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent intent =new Intent(WelcomeActivity.this, LoginActivity.class);
//                startActivity(intent);
//                finish();
//            }
//        });

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (LoginManager.isLoggedIn(WelcomeActivity.this)){
                    Intent intent =new Intent(WelcomeActivity.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                }else{
                    Intent intent =new Intent(WelcomeActivity.this, LoginActivity.class);
                    startActivity(intent);
                    finish();
                }
            }
        },1500);

    }
}